#include<bits/stdc++.h>
using namespace std;
int day[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
	int y,m,d,n;
	scanf("%d-%d-%d\n%d",&y,&m,&d,&n);
	while(n--)
	{
		int leap=y%4==0&&y%100!=0||y%400==0;
		day[2]=28+leap;
		d++;
		if(d>day[m])
			d=1,m++;
		if(m>12)
			m=1,y++;
	}
	printf("%d-%02d-%02d",y,m,d);
    return 0;
}
